package com.ty.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;

/**
 * <p>
 * 
 * </p>
 *
 * @author txy
 * @since 2024-03-02
 */
@Data
@TableName("order_item")
public class OrderItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 期刊id
     */
    private String periodicalId;

    /**
     * 订单id
     */
    private String orderId;

    /**
     * 期刊购买数量
     */
    private Integer num;

    /**
     * 期刊购买年数
     */
    private Integer year;

    /**
     * 起刊时间
     */
    private LocalDate startTime;

    /**
     * 下单时期刊单价
     */
    private Double price;

    @TableField(exist = false)
    private Book periodical;

    public OrderItem( String periodicalId, String orderId, Integer num, Integer year, LocalDate startTime, Double price) {
        this.periodicalId = periodicalId;
        this.orderId = orderId;
        this.num = num;
        this.year = year;
        this.startTime = startTime;
        this.price = price;
    }

    public OrderItem() {
    }
}
